import { useRoutes,Navigate } from 'react-router-dom'


import Login from '../components/login'
import Main from '../components/main'
import About from "../components/main/about"
import Home from "../components/main/home"
import News from '../components/main/about/news'
import Vedios from '../components/main/about/vedios'


const routes=[
    {
        path:"/login",
        element:<Login/>
    },
    {
        path:"/main",
        element:<Main/>,
        children:[
            {
                path:"/main/about",
                element:<About/>,
                children:[
                    {
                        path:"/main/about/news",
                        element:<News/>
                    },
                    {
                        path:"/main/about/vedios",
                        element:<Vedios/>
                    },
                ]
            },
            {
                path:"/main/home",
                element:<Home/>
            },
        ]
    },
    {
        path:"/",
        element:<Navigate to="/login"/>
    },
    {
        path:"*",
        element:<Navigate to="/login"/>
    },

]
export default routes

export const MyRoutes=()=>{
   return useRoutes(routes)
}

export const useMyRoute=()=>{
    return useRoutes(routes)
}